package com.education.service.impl;

import com.alibaba.druid.util.StringUtils;
import com.education.domain.Tbscore;
import com.education.domain.TbscoreExample;
import com.education.domain.TbscorePlus;
import com.education.mapper.TbscoreMapper;
import com.education.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by zhangjiawen on 2019/11/19.
 */
@Service
public class ScoreServiceImpl implements ScoreService {
    @Autowired
    private TbscoreMapper tbscoreMapper;


    @Override
    public List<Tbscore> getByCondition(TbscorePlus tbscore) {
        if(tbscore==null){ return null;}
        TbscoreExample tbscoreExample=new TbscoreExample();
        TbscoreExample.Criteria criteria = tbscoreExample.createCriteria();

        if(tbscore.getLcourseid()!=null){
            criteria.andLcourseidEqualTo(tbscore.getLcourseid());
        }
        if(tbscore.getLstudentid()!=null){
            criteria.andLstudentidEqualTo(tbscore.getLstudentid());
        }
        if(tbscore.getLtestid()!=null){
            criteria.andLtestidEqualTo(tbscore.getLtestid());
        }
        if(tbscore.getLteacherid()!=null){
            criteria.andLteacheridEqualTo(tbscore.getLteacherid());
        }
        if(tbscore.getLclassid()!=null){
            criteria.andLclassidEqualTo(tbscore.getLclassid());
        }
        if (tbscore.getLcourseid()!=null){
            criteria.andLcourseidEqualTo(tbscore.getLcourseid());
        }
        if(tbscore.getLtermid()!=null){
            criteria.andLtermidEqualTo(tbscore.getLtermid());
        }
        if(tbscore.getNgrade()!=null){
            criteria.andNgradeEqualTo(tbscore.getNgrade());
        }
        if(tbscore.getNhalfterm()!=null){
            criteria.andNhalftermEqualTo(tbscore.getNhalfterm());
        }
        if (tbscore.getLminscore()!=null){
            criteria.andLscoreGreaterThanOrEqualTo(tbscore.getLminscore());
        }
        if(tbscore.getLmaxscore()!=null){
            criteria.andLscoreLessThanOrEqualTo(tbscore.getLmaxscore());
        }


        return tbscoreMapper.selectByExample(tbscoreExample);
    }

    @Override
    public List<Tbscore> getAll() {
        return null;
    }

}
